import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
      loading:false,
      token:"",
      search_list:[],
      search_keywords:[],
      type_flag:true
  },
  mutations: {
      loading(state,b){
        state.loading=b;
      },
      search_list(state,a){
            state.search_list=a;
      },
      type_flag(state,a){
          state.type_flag=a;
      },
      update_keywords(state,a){
          if(state.search_keywords.length>8){
                state.search_keywords.shift();
          }
          state.search_keywords.push(a);
      },
      update_token(state,a){
          state.token=a;
          localStorage.setItem("token",a);
      }
  },
  actions: {
  },
  modules: {
  }
})
